<?php
/**
 * Created by jinqiang on 2024/12/31 10:18.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Services\Callback;


use App\Http\Models\Mysql\SsyPricingContractTable;

class EqbService
{
    public function sign($param)
    {
        $flowId = $param['flowId'];
        $action = $param['action'];
        switch ($action){
            case "SIGN_FLOW_UPDATE":
                if(in_array($param['authorizedAccountId'], ['a3a9862b74564e4c8ce33b1abba178a2', 'ce9c5202ebd34ea688db9c6062ae2acf',
                    '1357c55e751d4c63a9f86c7f3a7dfeca', '1357c55e751d4c63a9f86c7f3a7dfeca']) && $param['signResult'] == 2){
                    return (new SsyPricingContractTable())->updateDataWhere(['eqb_flow_id' => $flowId], ['a_status' => 1]);
                }else{
                    return (new SsyPricingContractTable())->updateDataWhere(['eqb_flow_id' => $flowId], [
                        'b_status' => 1,
                        'zs_time' => date('Y-m-d H:i:s')
                    ]);
                }
                break;
            case "SIGN_FLOW_FINISH":
                return (new SsyPricingContractTable())->updateDataWhere(['eqb_flow_id' => $flowId], [
                    'b_status' => 1,
                    'zs_time' => date('Y-m-d H:i:s')
                ]);
                break;
        }
    }
}
